package com.example.cloud.controller;

import com.example.cloud.apis.PayFeignApi;
import com.example.cloud.entities.PayDTO;
import com.example.cloud.resp.ResultData;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;



/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2024-03-09
 * Time: 13:47
 */

@RestController
@RequestMapping("/feign")
public class OrderController {

    @Resource
    private PayFeignApi payFeignApi; // 直接通过接口调用，不再需要使用 restTemplate


    @PostMapping("/pay/add")
    public ResultData addPay(@RequestBody PayDTO payDTO) {
        return payFeignApi.addPay(payDTO);
    }


    @GetMapping("/pay/get/{id}")
    public ResultData getById(@PathVariable("id") int id) {
        return payFeignApi.getById(id);
    }

    @GetMapping("/get/info")
    public String getInfoConsul() throws InterruptedException {
        return payFeignApi.getInfoByConsul();
    }

}
